/***************************************************************
This do-file cleans the vignette data
***************************************************************/





import delimited "$data/raw/voice_vignette.csv", bindquote(strict) varnames(1) stripquote(yes) encoding(UTF-8) clear 


keep if attention=="333"



ren prob_statusquo_join_10 prob_join_0
ren prob_statusquo_camp_10 prob_camp_0

ren prob_voice_join_4 prob_join_1
ren prob_voice_campaign_10 prob_camp_1



gen study_party=member_party=="partner" | supporter_party=="partner"

keep if prob_camp_1!=.
gen id=_n


*** Clean vignette order

gen voice_first= fl_86_do!="condition_statusquo|condition_voice"

gen prob_join_first = prob_join_0  if fl_86_do=="condition_statusquo|condition_voice"
replace prob_join_first = prob_join_1 if fl_86_do!="condition_statusquo|condition_voice"

gen prob_camp_first = prob_camp_0  if fl_86_do=="condition_statusquo|condition_voice"
replace prob_camp_first = prob_camp_1 if fl_86_do!="condition_statusquo|condition_voice"


*** Label variables ***
gen male =gender=="Male"
label var male "Male"

label var age "Age"

gen member = member_yes=="Yes"
label var member "Party member"


gen tertiary= education=="University or college"
label var tertiary "College degree"

gen vocational= education=="Vocational training"
label var vocational "Vocational degree"

gen student=employmentstatus=="Student"
label var student "Student"

gen retired=employmentstatus=="Retired"
label var retired "Retired"

gen employed= employmentstatus=="part time job" | employmentstatus=="Fulltime job"
label var employed "Working"

gen supporter=supporter_yes=="Yes"
label var supporter "Party supporter"

gen experience=experience_campaign=="Yes"
label var experience "Has experience canvassing"


keep prob_join_* prob_camp_*  voice_* id supporter experience employed retired student  vocational  tertiary member  age male 


save "$data/clean/vignette.dta", replace





